package drrr.orm;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * Created by lirance on 15/5/26.
 */
public class RoomChatListEntityPK implements Serializable {
    private int roomid;
    private int userid;
    private Timestamp time;

    @Column(name = "roomid", nullable = false, insertable = true, updatable = true)
    @Id
    public int getRoomid() {
        return roomid;
    }

    public void setRoomid(int roomid) {
        this.roomid = roomid;
    }

    @Column(name = "userid", nullable = false, insertable = true, updatable = true)
    @Id
    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    @Column(name = "time", nullable = false, insertable = true, updatable = true)
    @Id
    public Timestamp getTime() {
        return time;
    }

    public void setTime(Timestamp time) {
        this.time = time;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RoomChatListEntityPK that = (RoomChatListEntityPK) o;

        if (roomid != that.roomid) return false;
        if (userid != that.userid) return false;
        if (time != null ? !time.equals(that.time) : that.time != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roomid;
        result = 31 * result + userid;
        result = 31 * result + (time != null ? time.hashCode() : 0);
        return result;
    }
}
